package com.cug.nageoffer.user.config;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ElasticSearchConfiguration {
    //esIP地址
    //@Value("${elasticsearch.host}")
    private String host = "113.45.188.152";
    //es 端口号
    //@Value("${elasticsearch.port}")
    private Integer port = 9200;
    @Bean
    public RestHighLevelClient restHighLevelClient() {
        RestClientBuilder builder= RestClient.builder(new HttpHost(host, port, "http"));
        return new RestHighLevelClient(builder);
    }
}
